import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("bilibili", style: TextStyle(color: Colors.white)),
          centerTitle: true,
          backgroundColor: Colors.pinkAccent,
        ),
        body: HomeWidget(),
      ),
    );
  }
}

class HomeWidget extends StatelessWidget {
  const HomeWidget({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Center(
      child: Container(
        decoration: BoxDecoration(
            border: Border.all(
          color: Colors.red,
          width: 2.0,
          style: BorderStyle.solid,
        )),
        // color: Colors.yellowAccent,
        width: 400.0,
        height: 400.0,

        // alignment:Alignment.center,
        child: Text(
          "this is main content",
          style: TextStyle(color: Colors.cyan, fontSize: 24),
          textAlign: TextAlign.center,
        ),
      ),
    );

    throw UnimplementedError();
  }
}

//自定义组件继承一个无状态组件
// class MyApp extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return MaterialApp(
//       title: "demo 2",
//       debugShowCheckedModeBanner: false,
//       theme: ThemeData.light(),
//       home: IndexPage(),
//     );
//   }
// }
